const db = require('../config/db');
class novel {
    banner (page=1, pageSize=10){

        return new Promise(function(resolve) {
            try {
                db.novel_base.findAndCountAll({
                    where:{
                        status:1,
                    },
                    limit: pageSize,
                    offset: (page-1)*pageSize

                }).then(ret=>{
                    console.log('banner',ret)
                    resolve(ret);
                })
            }catch (e) {
                console.log(e);
                reject({ret_code: 2, ret_msg: '获取数据失败'});
            }




        });



    }

  novel_info (nid){
    return new Promise(function(resolve) {
      try {
        db.novel_base.find({
          where:{
            status:1,
            collect_id:nid
          }

        }).then(ret=>{
          console.log('novel_info',ret)
          resolve(ret);
        })
      }catch (e) {
        console.log(e);
        reject({ret_code: 2, ret_msg: '获取数据失败'});
      }

    });
  }
}

module.exports = novel;
